/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package util.www.sql;

import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Rdelacruz
 */
public class TestSql {
    
    public static void main(String[] args) {
        try {
            String s = null;
            
            WhereSql w1 = new WhereSql();
            w1.and("a=","1");            
            w1.and("b=","2");
            System.out.println("w1:"+w1.getSql());
            //w1.and("p=",s);                    
            
            WhereSql w2 = new WhereSql().and("c=", 3).or("c=", 4);
            System.out.println("w2:"+w2.getSql());
            
            w1.and(w2);                       
            System.out.println("w1:"+w1.getSql());
                        
            WhereSqlDinamico w3 = new WhereSqlDinamico();
            w3.and("x=",s)
              .and("y=","")
              .and("z=","abc")
              .or(w2)
              .and(w1)
            ;
            
                       
            System.out.println("w3:"+w3.getSql());
            
            WhereSql w4 = new WhereSql();
            w4.and("a=?");
            w4.and("b=?");
            
            w4.setParametro(1, 123);
            w4.setParametro(2, "Hola");            
            System.out.println("w4:"+w4.getSql());
            
            w4.setParametro(1, 10);            
            System.out.println("w4:"+w4.getSql());
            
            w4.setParametro(2, 20);            
            System.out.println("w4:"+w4.getSql());
            
        } catch (SQLException ex) {
            Logger.getLogger(TestSql.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }
}
